<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/min.js"></script>
    <script type="text/javascript" src="../script/jq.min.js"></script>
    <script type="text/javascript" src="../script/vm.jq2.1.4.mini.js"></script>
    <title>消息列表</title>
    <style>

    </style>
</head>
<body style="background: #f4f4f4">
<div id="cont">

</div>
<script id="theTmpl" type="text/x-jsrender">
    <div style="border: 2px #f4f4f4 solid;border-radius:4px;background: white;margin-bottom: 20px;padding:3px;">
        <div style="padding: 10px;">
            <div style="padding: 15px;">
                <div style="display: inline-block;font-size: 1.3rem;">{{>s_name}}</div>
                <div style="display: inline-block;float: right;font-size: 0.8rem;color: rgba(0,0,0,0.58);">{{>add_time}}</div>
            </div>
            <div style="padding: 5px;font-size: 1rem; margin-left: 3%;color: rgba(0,0,0,0.58);">
                {{>msg}}
            </div>
        </div>
    </div>


</script>

</body>
<script type="text/javascript">

    apiready = function () {
        var deviceId = api.deviceId;//设备编码
        get_data(deviceId);
    };

    function get_data(deviceId) {
        //开启加载动画
        api.showProgress({
            title: '努力加载中...',
            modal: false
        });
        $.ajax({
            type: "POST",
            url: "http://www.solearn.top/paotui/public/index.php/index/index/get_msg_data",
            dataType: "json",
            data: {deviceId: deviceId},
            success: function (res) {
                api.hideProgress();//关闭加载动画
                if (res.status == 1) {
                    $("#cont").html($.templates("#theTmpl").render(res.result));
                } else {
                    $("#cont").html("<span>暂无消息</span>");
                }
            }
        });
    }


</script>
</html>